package com.easy;

/**
 * Created by Lxk on 2019/5/17.
 */
public class Solution125 {

    public boolean isPalindrome(String s) {
        StringBuffer sb = new StringBuffer();
        for(int i = 0;i < s.length(); i++){
            if((s.charAt(i) >= '0' && s.charAt(i) <= '9')
                    || (s.charAt(i) >= 'a' && s.charAt(i) <= 'z')
                    || (s.charAt(i) >= 'A' && s.charAt(i) <= 'Z')){
                sb.append(s.charAt(i));
            }
        }
        String test = sb.toString().toLowerCase();
        for(int i = 0;i < test.length()/2; i++){
            if(test.charAt(i) != test.charAt(test.length()-i-1)){
                return false;
            }
        }
        return true;
    }

}
